home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
comm
/
misc
/
xqsrc1_7.lzh
/
include
/
xferq.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-13
|
12KB
|
353 lines
/*
* Name: xferq.h
*
* Description: Public include file for xferq.library
*
* Copyright: 1992-1993 by David Jones.
*
* Distribution:
* This source file is released with no restrictions in its use
* whatsoever, provided that it is included free of charge in the
* source and binary distributions of xferq.library.
*
* In particular, you may use this file to interface to xferq.library
* without subjecting your application to the terms and conditions of
* the GNU General Public License or the General Library Public License.
* The intent is to prevent the fact that xferq.library is copylefted
* from being a deterrent to its use by non-copylefted programs.
*
* Please note that this distribution notice applies only to those
* source files having this notice at the top of the file. All other
* source files are subject to the terms and conditions of the
* General Public License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to:
*
* The Free Software Foundation David Jones
* 675 Mass Ave 6730 Tooney Drive
* Cambridge, MA Orleans, Ontario
* 02139 K1C 6R4
* USA Canada
*
* Usenet: gnu@prep.ai.mit.edu aa457@freenet.carleton.ca
* Fidonet: 1:163/109.8
*
*/
#ifndef XFERQ_H
#define XFERQ_H
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
#ifndef EXEC_LISTS_H
#include <exec/lists.h>
#endif
#ifndef EXEC_NODES_H
#include <exec/nodes.h>
#endif
#define USE_PRIVATE_POOL
#ifndef USE_PRIVATE_POOL
#ifndef EXEC_MEMORY_H
#include <exec/memory.h>
#endif
#endif
#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif
extern struct Library *XferqBase;
/*
* Defines for XfqAnyWork()
*/
#define NO_WORK 0 /* No work at all */
#define LOCKED_WORK 1 /* There's work, but someone locked it */
#define UNLOCKED_WORK 2 /* There's unlocked work */
#define PENDING_WORK 3 /* No work, but a packer's busy making some */
/*
* Return codes for XfqRemoveWork()
*/
#define XQRM_UNSENT 0 /* File's status was not XQ_SENT -> no op */
#define XQRM_SENT 1 /* File was sent, nothing else */
#define XQRM_DELETED 1 /* File was deleted */
#define XQRM_TRUNCATED 2 /* File was truncated */
#define XQRM_ERROR 3 /* Something nasty happened */
/*
* User flags
*/
#define XQ_DELETE 1 /* Delete file after sending */
#define XQ_TRUNCATE 2 /* Truncate file after sending */
#define XQ_IMMEDIATE 4 /* Send only if session currently up */
#define XQ_SENDLATER 8 /* Make eligible after session goes down */
/*
* Status
*/
#define XQ_UNSENT 0 /* Node has not been sent */
#define XQ_SENT 1 /* Node has been sent */
#define XQ_INTRANSIT 2 /* File is being sent */
/* The following are taken from flow.library/work_detail.h */
#define XQ_HUNGUP 3 /* Remote end hung up on us */
#define XQ_RETRIES 4
#define XQ_ABORT 5
#define XQ_REFUSED 6
#define XQ_PRIREJ 7
#define XQ_NOTFOUND 8
/*
* Priority
*/
#define XQ_MINPRI -127 /* smallest tx priority */
#define XQ_MAXPRI 127 /* highest tx priority */
#define XQ_NOPRI -128 /* special value: no nodes in list */
#define XQSESS_PRIVATE 1 /* This is a private session */
/*
* Network types
*/
#define XQNT_FIDO 'FIDO'
#define XQNT_FQDA 'FQDA'
#define XQNT_UUCP 'UUCP'
#define XQNT_TEXT 'TEXT'
/*
* Object types
*/
#define XQO_NULL 0
#define XQO_ADDRESS 1
#define XQO_ARRAY 2
#define XQO_STRING 3
#define XQO_SESSION 4
#define XQO_WORKNODE 5
/*
* Flags for address I/O
*/
#define XQADDR_USERNAME 1
#define XQADDR_DOMAIN 2
#define XQADDR_ZONE 4
#define XQADDR_NET 8
#define XQADDR_NODE 16
#define XQADDR_POINT 32
#define XQADDR_MACHINE 64
#define XQADDR_FQDA 128
#define XQADDR_2D (XQADDR_NET | XQADDR_NODE)
#define XQADDR_3D (XQADDR_2D | XQADDR_ZONE)
#define XQADDR_4D (XQADDR_3D | XQADDR_POINT)
#define XQADDR_FIDO (XQADDR_4D | XQADDR_DOMAIN)
#define XQADDR_TEXT 256
#define XQADDR_ANYTHING 511
#define XQADDR_ALLBUTUSER (XQADDR_ANYTHING & ~XQADDR_USERNAME)
#define XQADDR_ATDOMAIN 1024 /* PutAddress only */
#define XQADDR_DELTA 2048 /* PutAddress only */
/*
* Tags for all functions
*/
#define XQ_BASE 0x8000FC00
#define XQ_OBASE (XQ_BASE + 0x80) /* Start of object values */
/* Work nodes */
#define XQ_Name (XQ_OBASE + 0) /* Filename */
#define XQ_AsName (XQ_OBASE + 1) /* Asname */
#define XQ_Pri (XQ_OBASE + 2) /* Priority */
#define XQ_Flags (XQ_OBASE + 3) /* File management flags */
#define XQ_Status (XQ_OBASE + 4) /* File status */
#define XQ_Site (XQ_OBASE + 5) /* Site */
/* Addresses */
#define XQ_Network (XQ_OBASE + 16) /* 'FIDO', 'FQDA', 'INET', etc */
#define XQ_ZoneStr (XQ_OBASE + 17) /* Fidonet zone */
#define XQ_NetStr (XQ_OBASE + 18) /* Fidonet net */
#define XQ_NodeStr (XQ_OBASE + 19) /* Fidonet node */
#define XQ_PointStr (XQ_OBASE + 20) /* Fidonet point */
#define XQ_Domain (XQ_OBASE + 21) /* Fidonet domain */
#define XQ_UserName (XQ_OBASE + 22) /* Network user name */
#define XQ_UucpName (XQ_OBASE + 23) /* UUCP address */
#define XQ_Zone (XQ_OBASE + 24)
#define XQ_Net (XQ_OBASE + 25)
#define XQ_Node (XQ_OBASE + 26)
#define XQ_Point (XQ_OBASE + 27)
#define XQ_FqdaName (XQ_OBASE + 28) /* FQDA name */
#define XQ_TextName (XQ_OBASE + 29) /* Text address */
/* Sessions/nodes */
#define XQ_SessFlags (XQ_OBASE + 32) /* Session flags */
/* Array/string */
#define XQ_Size (XQ_OBASE + 48) /* Object size */
/* Other */
#define XQ_ErrorCode (XQ_BASE + 1) /* Extended error codes */
#define XQ_ErrorMsg (XQ_BASE + 2) /* Extended error message */
#define XQ_IncLocked (XQ_BASE + 3) /* Include locked items */
#define XQ_AddHead (XQ_BASE + 4) /* Add item at head */
#define XQ_AddTail (XQ_BASE + 5) /* Add item at tail */
#define XQ_AddSorted (XQ_BASE + 6) /* Add item in sorted position */
#define XQ_AddGlobal (XQ_BASE + 7) /* Add item to global session */
#define XQ_Reverse (XQ_BASE + 8) /* Walk session in reverse dir */
#define XQ_MapForward (XQ_BASE + 9) /* Map in forward direction */
#define XQ_MapReverse (XQ_BASE + 10) /* Map in reverse direction */
#define XQ_Filter (XQ_BASE + 11) /* Apply a filter */
#define XQ_CallBack (XQ_BASE + 12) /* Callback function */
#define XQ_NoCopyStrs (XQ_BASE + 13) /* Don't copy string data */
#define XQ_EndPos (XQ_BASE + 14) /* End position for parse */
#define XQ_Mandatory (XQ_BASE + 15) /* Mandatory fields */
#define XQ_Optional (XQ_BASE + 16) /* Optional fields */
#define XQ_LineSize (XQ_BASE + 17) /* Length of line */
#define XQ_Delta (XQ_BASE + 18) /* Output address diffs */
#define XQ_Inclusive (XQ_BASE + 19) /* All must match */
#define XQ_SpaceDelim (XQ_BASE + 20) /* Space is allowable in addr */
#define XQ_SessOnly (XQ_BASE + 21) /* Only report nodes w/sessions */
#define XQ_MinPri (XQ_BASE + 22) /* Minimum priority */
#define XQ_MaxPri (XQ_BASE + 23) /* Maximum priority */
/*
* Extended error codes. If you pass in XQ_ErrorCode followed by a
* long pointer, the longword will be filled in with one of the
* following:
*/
#define XQERROR_OK 0 /* no error */
#define XQERROR_NOMEM 1 /* out of memory */
#define XQERROR_DOS 2 /* AmigaDOS error - use IoErr() */
#define XQERROR_ENDQUEUE 3 /* End of queue reached for XfqScanWork */
#define XQERROR_NOTAG 4 /* Required value is missing */
#define XQERROR_LOCKED 5 /* Requested node is locked */
#define XQERROR_NOEXIST 6 /* Node does not exist */
#define XQERROR_BADADR 7 /* Illegal address specification */
#define XQERROR_NOSESSION 8 /* No session for XQ_IMMEDIATE */
#define XQERROR_BADOBJECT 9 /* Illegal object for function call */
#define XQERROR_QUEUED 10 /* Work is already queued to site */
#define XQERROR_MAX 10
/*
* We really shouldn't need this but SAS/C 6.2 barfs.
* Commodore could look into this:
* ULONG (*func)() != ULONG (*func)(register __ etc) due to assumption
* of stack conventions when arguments are not given.
*/
typedef ULONG (*HOOK_FUNC)();
/*
* Prototypes
*/
ULONG XfqAddWork(struct NetAddress *, struct WorkNode *);
ULONG XfqAddWorkQuick(char *, char *, char *, LONG, LONG);
ULONG XfqAnyWork(void *, struct TagItem *);
struct WorkNode *XfqGetWork(void *, struct TagItem *);
struct WorkNode *XfqFindWork(struct TagItem *);
void XfqUnlockWork(struct WorkNode *);
ULONG XfqRemoveWork(struct WorkNode *);
LONG XfqMaxSitePri(void *);
void XfqWalkQueueCallBack(struct NetAddress *, struct TagItem *);
struct Session *XfqGetSiteList(void);
void XfqFlushQueue(void *object);
ULONG XfqBeginSession(struct Session *, struct TagItem *);
void XfqEndSession(struct Session *, void *);
ULONG XfqSessionUp(struct NetAddress *);
void XfqSortSession(struct Session *, struct TagItem *);
void XfqWalkSessionCallBack(struct Session *, struct TagItem *);
ULONG XfqNextSeq(void);
void *XfqHook(struct TagItem *);
struct NetAddress *XfqGetAddress(char *, struct NetAddress *, struct TagItem *);
char *XfqPutAddress(void *, struct TagItem *);
LONG XfqCmpAddress(void *, void *, struct TagItem *);
struct NetAddress *XfqMap(struct NetAddress *, struct TagItem *);
ULONG XfqFilter(void *, struct TagItem *);
LONG XfqGetError(void);
char *XfqErrorMsg(LONG);
void *XfqCreateObject(ULONG, struct TagItem *);
void XfqDropObject(void *);
void XfqExamObject(void *, struct TagItem *);
void *XfqModifyObject(void *, struct TagItem *);
void *XfqCopyObject(void *);
ULONG XfqHoldMailer(struct NetAddress *);
ULONG XfqReleaseMailer(struct NetAddress *);
/*
* Varargs prototypes
*/
struct WorkNode *XfqFindWorkTags(Tag, ...);
void XfqWalkQueueCallBackTags(struct NetAddress *, Tag, ...);
struct WorkNode *XfqGetWorkTags(void *, Tag, ...);
ULONG XfqAnyWorkTags(void *, Tag, ...);
ULONG XfqBeginSessionTags(struct Session *, Tag, ...);
void XfqSortSessionTags(struct Session *, Tag, ...);
void XfqWalkSessionCallBackTags(struct Session *, Tag, ...);
void *XfqHookTags(Tag, ...);
struct NetAddress *XfqGetAddressTags(char *, struct NetAddress *, Tag, ...);
char *XfqPutAddressTags(void *, Tag, ...);
LONG XfqCmpAddressTags(void *, void *, Tag, ...);
struct NetAddress *XfqMapTags(struct NetAddress *, Tag, ...);
ULONG XfqFilterTags(void *, Tag, ...);
void *XfqCreateObjectTags(ULONG, Tag, ...);
void XfqExamObjectTags(void *, Tag, ...);
void *XfqModifyObjectTags(void *, Tag, ...);
#ifdef __SASC_60
/*
* The following lines define the tag interface and eliminate need
* for xferqglue.c. SAS/C 6.0 required!!!
*/
#pragma tagcall XferqBase XfqHookTags 24 801
#pragma tagcall XferqBase XfqFindWorkTags 4E 801
#pragma tagcall XferqBase XfqWalkQueueCallBackTags 66 9802
#pragma tagcall XferqBase XfqBeginSessionTags 78 9802
#pragma tagcall XferqBase XfqSortSessionTags 8A 9802
#pragma tagcall XferqBase XfqWalkSessionCallBackTags 90 9802
#pragma tagcall XferqBase XfqGetAddressTags 9C A9803
#pragma tagcall XferqBase XfqPutAddressTags A2 9802
#pragma tagcall XferqBase XfqCmpAddressTags A8 A9803
#pragma tagcall XferqBase XfqMapTags AE 9802
#pragma tagcall XferqBase XfqFilterTags B4 9802
#pragma tagcall XferqBase XfqCreateObjectTags C6 8002
#pragma tagcall XferqBase XfqExamObjectTags D2 9802
#pragma tagcall XferqBase XfqModifyObjectTags D8 9802
#pragma tagcall XferqBase XfqAnyWorkTags 42 9802
#pragma tagcall XferqBase XfqGetWorkTags 48 9802
#pragma tagcall XferqBase XfqMaxSitePriTags 60 9802
#endif
#endif /* XFERQ_H */